package factory;

import dao.Impl.NewsDaoImpl;
import dao.Impl.NewsDaoMySqlImpl;
import dao.Impl.NewsDaoOracleImpl;
import dao.Impl.NewsDaoRedisImpl;
import dao.NewsDao;
import pojo.News;
import service.NewsService;

public class SimpleDaoFactory {
    public static NewsDao getInstance(String key){
//        return new NewsDaoImpl();
        switch (key){
            case "mysql":
                return new NewsDaoMySqlImpl();
            case "oracle":
                return new NewsDaoOracleImpl();
            case "redis":
                return new NewsDaoRedisImpl();
            default:
                throw new RuntimeException("无效的数据库类型："+key+"，DAO获取失败");
        }
    }
}
